<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix="c" uri="/WEB-INF/tlds/hdiv-c.tld"%>
<%@ taglib prefix="form" uri="/WEB-INF/tlds/hdiv-spring-form-3_0_4.tld"%>
<%@ taglib prefix="spring" uri="/WEB-INF/tlds/hdiv-spring.tld" %>
<%@ taglib prefix="display" uri="http://displaytag.sf.net" %>
<%@ page contentType="text/html;charset=windows-1252"%>
<Script type="Text/JavaScript" src="javascript/HMF2003.js"></Script>
<Script type="Text/JavaScript">
  var jsonrpc = new JSONRpcClient("getJSON.html");
    $(document).ready(function(){
    
        /*$(".verDetalle").click(function(i){
            tipDocuCmpb = $(this).attr("tipDocuCmpb");
            codSeriCmpb = $(this).attr("codSeriCmpb");
            numCmpb = $(this).attr("numCmpb");
            id = tipDocuCmpb+"-"+codSeriCmpb+"-"+numCmpb;
            $("#id").val(id);
            $("#accion").val("showDeta");
            $("form").submit();
        });*/
        
        
        $("#cs").focus(); 
        $("#listaSeries").html("");
        $("a[rel='verDetalle']").live("click",function(){
            tipDocuCmpb= $(this).attr("tipDocuCmpb");
            codSeriCmpb= $(this).attr("codSeriCmpb");
            numCmpb= $(this).attr("numCmpb");
            $.get("<c:url value='mostrarHWF3006.html'/>",{accion:"verDetalle",tipDocuCmpb:tipDocuCmpb, codSeriCmpb:codSeriCmpb,numCmpb:numCmpb}, 
                function(responseText, status, xmlHttpRequest){
                 $('#contenidoDeta').html($('#contenido', responseText).html());
                 callEvent();
            });
        });
        
        
        $("#mostrar").click(function(){
            
            $.blockUI({ message: '<img src="imagenes/logoProcesandoRight.gif" />', css:{ backgroundColor: '#FFFFFF', color: '#fff'} });
            $.get("<c:url value='mostrarHWF3006.html'/>",{accion:"mostrar",cs:$("#cs").val()}, 
                function(responseText, status, xmlHttpRequest){
                  if($('#contenido', responseText).html()==null){
                   
                    $('#listaSeries').html($('#listaSeries', responseText).html());
                    $('#contenidoDeta').html("");
                  }else{
                    $('#contenidoDeta').html($('#contenido', responseText).html());
                    callEvent();
                    $('#listaSeries').html("");
                  }
                  $.unblockUI();
                });

        });
        
        
        
   });
   function callEvent(){
                    $("#boveDenoTable").hide();
                $("#boveDenoMessage").hide();
                $("#boveDenoTable").hide();
        $("#boveDenoMessage").hide();
        $('.ui-state-default').hover(
        function(){ $(this).addClass('ui-state-hover'); },
        function(){ $(this).removeClass('ui-state-hover'); }
        );
        $('.ui-state-default').click(function(){ $("#accion").val("regresar");$("form").submit(); });         
        $("#toogleEnv").click(function(){
            $("#tableEnv").toggle();
            if ( $('#tableEnv').is(':visible') ){
                $("#toogleEnv").removeClass("ui-icon-triangle-1-e");
                $("#toogleEnv").addClass("ui-icon-triangle-1-s");
            }else{
                $("#toogleEnv").removeClass("ui-icon-triangle-1-s");
                $("#toogleEnv").addClass("ui-icon-triangle-1-e");
            }
        });
        $("#toogleAnom").click(function(){
            $("#tableAnom").toggle();
            if ( $('#tableAnom').is(':visible') ){
                $("#toogleAnom").removeClass("ui-icon-triangle-1-e");
                $("#toogleAnom").addClass("ui-icon-triangle-1-s");
            }
            else{
                $("#toogleAnom").removeClass("ui-icon-triangle-1-s");
                $("#toogleAnom").addClass("ui-icon-triangle-1-e");
            }
        });
        $("#regresar").click(function(){
            $("#accion").val("regresar");
            $("form").submit();
        });
        $("#csDetaBove").dialog({
                            modal: true,
                            width: 700,
                            autoOpen: false,
                            resizable: false,
                            buttons: {
                                    Cerrar: function() {
                                        $( this ).dialog( "close" );
                                    }
                            }
        });
        $( "#csDetaBoveAccordion" ).accordion({
            autoHeight: false,
            height: 50,
            animated: false
        });
        $(".verBoveDeta").click(function(i){            
            $("#csDetaBove").dialog("open");
            tipDocuCmpb = $(this).attr("tipDocuCmpb");
            codSeriCmpb = $(this).attr("codSeriCmpb");
            numCmpb = $(this).attr("numCmpb");
            codBove = $(this).attr("codBove");
            codSucuHtb = $(this).attr("codSucuHtb");
            codClieCnta = $(this).attr("codClieCnta");
            
            desBove = $(this).attr("desBove");
            montDiceCont = $(this).attr("montDiceCont");
            monValoProd = $(this).attr("monValoProd");
            monDife = $(this).attr("monDife");
            
            jsonrpc.jsonService.putListBoveDetasOnSession(tipDocuCmpb,codSeriCmpb,numCmpb,codBove,codSucuHtb,codClieCnta);
            var listBoveDeta = jsonrpc.jsonService.getListBoveDeta();
            alert(listBoveDeta.length);
            if(listBoveDeta.length==0)
                $("#boveDenoMessage").hide();
            var listBoveAbon = jsonrpc.jsonService.getListBoveAbon();
            var listBoveMyorCtia = jsonrpc.jsonService.getListBoveMyorCtia();
            $("#desBove").html(desBove);
            $("#montDiceCont").html(montDiceCont);
            $("#monValoProd").html(monValoProd);
            $("#monDife").html(monDife);
            $.get("<c:url value='mostrarHWF3006.html'/>",{accion:"showBoveDeta"}, function(responseText, status, xmlHttpRequest){
                    $('#boveDetaDiv').html($('#boveDetaDiv', responseText).html());
                    $('#boveAbonDiv').html($('#boveAbonDiv', responseText).html());
                    $('#boveMyorCtiaDiv').html($('#boveMyorCtiaDiv', responseText).html());
                    $("#boveDetaTable").tableScroll();
                }
            )
            $('span.pagelinks>a, table#dispTable>thead>tr>th>a').live('click', function(){
                $.get($(this).attr('href'), function(responseText, status, xmlHttpRequest){
                        $('.its').html($('.its', responseText).html());
                    }
                )
                return false;
            })
        });
                
                
            
   }
    
    function cursor_wait() {
      document.body.style.cursor = 'wait';
    }
    
    function show_loading(){  
        var loadingAnim = document.getElementById('loading_mostrar');  
        loadingAnim.innerHTML = '<img src="imagenes/logoProcesandoDown.gif" width=' + xx_d + 'height=' + yy_d + 'alt="Procesando" />';  
        loadingAnim.style.display = 'block';      
        } 

    function mostrarMontos() {
        moveForward('mostrarMontos');
    }

    function showBoveDeta(tipDocuCmpb,codSeriCmpb,numCmpb,codBove,codSucuHtb,codClieCnta,desBove,montDiceCont,monValoProd,monDife,tipRcto){    
      $("#csDetaBove").dialog("open");
      jsonrpc.jsonService.putListBoveDetasOnSession(tipDocuCmpb,codSeriCmpb,numCmpb,codBove,codSucuHtb,codClieCnta);
      var listBoveDeta = jsonrpc.jsonService.getListBoveDeta();
      var listBoveAbon = jsonrpc.jsonService.getListBoveAbon();
      var listBoveMyorCtia = jsonrpc.jsonService.getListBoveMyorCtia();
      var listBoveDetaLength = listBoveDeta.length;
      if(listBoveDetaLength>0&&tipRcto!=8){
          $("#boveDenoMessage").show();
      }
      $("#desBove").html(desBove);
      $("#montDiceCont").html(montDiceCont);
      $("#monValoProd").html(monValoProd);
      $("#monDife").html(monDife);
      $.get("<c:url value='mostrarHWF3006.html'/>",{accion:"showBoveDeta"}, function(responseText, status, xmlHttpRequest){
              $('#boveDetaDiv').html($('#boveDetaDiv', responseText).html());
              $('#boveAbonDiv').html($('#boveAbonDiv', responseText).html());
              $('#boveMyorCtiaDiv').html($('#boveMyorCtiaDiv', responseText).html());
              $("#boveDetaTable").tableScroll();
              $("#boveDetaTable tr").click(function(i){                                
                  $("#boveDenoTable").find("tbody").html("");                
                  nseSecu2 = $(this).children("td:first-child").text();
                  nseSecu = $(this).children("td:first-child").children("div:first-child").attr("numSecu");
                  nombreCodCant= $(this).children("td:first-child").next().text();
                  if(tipRcto!=8){
                      $("#boveDenoTable").show();                    
                      $('#boveDenoTableTituloDiv').html("Seleccionado: "+nombreCodCant);
                      var listBoveDeno = jsonrpc.jsonService.getListBoveDeno(tipDocuCmpb,codSeriCmpb,numCmpb,codBove,codSucuHtb,nseSecu);
                      var listSize = listBoveDeno.length;
                      for(var i=0;i<listSize;i++){
                          $("#boveDenoTable").find("tbody")
                          .append($('<tr>')
                              .append($('<td>')
                              .append(listBoveDeno[i].desTipMone)                        
                              )
                              .append($('<td>')
                                .append(listBoveDeno[i].canValoNomi)                        
                              )
                              .append($('<td align="right">')
                                .append(new NumberFormat(listBoveDeno[i].monDeno).toFormatted())                        
                              )
                              .append($('<td align="right">')
                                .append(listBoveDeno[i].canPiez)
                              )
                        );
                      }
                  }
              });
          }
      )
      $('span.pagelinks>a, table#dispTable>thead>tr>th>a').live('click', function(){
          $.get($(this).attr('href'), function(responseText, status, xmlHttpRequest){
                  $('.its').html($('.its', responseText).html());
              }
          )
          return false;
      });
    
  }

function openActa(idCmpb, winheight,winwidth)
{
    winwidth='450';
    winheight='920';
    window.open('about:blank', 'window1', 'location=0,directories=0,status=0,scrollbars=1,resizable=1,width='+winwidth+',height='+winheight);
    var accion = 'mostrarActa';
    var target = 'window1'; 
    $("#formulario").val('HMR3003a');
    $("#idCmpb").val(idCmpb); 
    $("#form").attr("target",target);
    $("#accion").val(accion);
    $("#form").submit();
    $("#form").attr("target","_self");
} 


    </script>

<style type="text/css">  
<!-- 
#loading_mostrar {display:none;}  
-->  
</style> 

<form:form    modelAttribute="form">
<form:hidden path="control"/>
<form:hidden path="accion"/>
<form:hidden path="tipoUnidad"/>
<form:hidden path="diceContener"/>
<form:hidden path="id"/>
<form:hidden path="formulario"/>
<form:hidden path="idCmpb" />
<!--Favoritos:-->
<input type="hidden" id="codOpci" value="${codOpci}"/>
<input type="hidden" id="desOpci" value="${desOpci}"/>

<table id="fullheighttable" width="775" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td align="left" valign="top" class="fondo_contenido padtop16left21">
              <table border="0" cellspacing="0" cellpadding="0" class="verdana11bazul">
      <tr>
        <td height="22" align="left" valign="top" class="verdana11bazul">
		<ul class="navlist2">
		<li>COMPROBANTE DE SERVICIO</li>
		</ul>
        </td>
        <td width="210"> </td>
        <td>
           <a href="#" id="opener_agregarFavoritos"> <img src="images/agregar_favoritos.png" width="25" height="23" border="0" title='Agregar Favoritos'/> </a>
        </td>
      </tr>
      <tr>
        <td align="left" valign="top" class="borde_totalblanco"><table border="0" cellspacing="0" cellpadding="0">
          <tr>
          
            <c:if test="${sessionScope.tipClie!=0}">
              <td width="100" height="23" align="left" valign="top" class="verdana10bazul">Cliente</td>
              <td height="23" align="left" valign="top" class="verdana10negro">                
                <c:out value="${sessionScope.desRazoSoci}"/>
              </td>
            </c:if>
            <c:if test="${sessionScope.tipClie==0}">
              <td width="100" height="23" align="left" valign="top" class="verdana10bazul">Corporaci&oacute;n</td>
              <td height="23" align="left" valign="top" class="verdana10negro">                
                <c:out value="${sessionScope.desCorp}"/>
              </td>
            </c:if>
          </tr>

          <tr>
            <td height="34" align="left" class="verdana10bazul">Nro. de Comprobante</td>
            <td height="34" align="left" valign="bottom" class="verdana10negro">
            <table border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td align="center" class="padright10">
                    <div class="fondo_txtbox128">
                                                        <form:input path="cs"
                                                                    maxlength="10"
                                                                    size="12"
                                                                    onkeypress="return validaNumerosEnteros(window.event.keyCode);"/>
                                                    </div>
                  </td>
                  <td width="60" height="34" align="left" class="verdana10bazul">&nbsp;</td>
                  <td align="center" class="padright10">&nbsp;</td>
                  <td width="140" align="right" valign="middle">
                    <input name="mostrar" id="mostrar" type="button" class="boton" value="Mostrar" >
                  </td>
                </tr>
            </table></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td class="verdana11rojo"> 
            <div id="contenido" >
                   <div id="div1" style="color:red;">
                   <c:out value="${form.msgErro}" /></div>
           </div>
            </td>
          </tr>
        </table>
        </td>
      </tr>
          
         <tr>
    <td>

		<div id="listaSeries">	

        <c:if  test="${not empty listCmpbServ}">
        <table class="its7">
            <thead>
            <tr>
                <th>Item</th>
                <th>Tipo</th>
                <th>Serie</th>
                <th>N&uacute;mero</th>
                <th>Descripci&oacute;n</th>
                <th>Fecha Cont.</th>
                <th>Detalle</th>                
            </tr>
            </thead>
            <c:set var="item" value="0"/>
            <tbody>
            <c:forEach items="${listCmpbServ}" var="cs">
            <c:set var="item" value="${item+1}"/>
            <tr>
                <td>${item}</td>
                <td>${cs.tipDocuCmpb}</td>
                <td>${cs.codSeriCmpb}</td>
                <td>${cs.numCmpb}</td>
                <td>${cs.desTipFormTras}</td>
                <td>${cs.fecProcAper}</td>
                <td><a href="#" rel="verDetalle"  tipDocuCmpb="${cs.tipDocuCmpb}" codSeriCmpb="${cs.codSeriCmpb}" numCmpb="${cs.numCmpb}" class="verDetalle">detalle</a></td>
            </tr>
            </c:forEach>
            </tbody>
        </table>
        </c:if>
		</div>
    <div id="contenidoDeta"> </div>
		
    </td>
  </tr>
  <tr>
    <td colspan="6" align="center">    
    <div id="loading_mostrar"><img id="logoDown" src="imagenes/logoProcesandoDown.gif" alt="Procesando" /></div>  
    </td>
 </tr> 
    </table>

    

    </td>
  </tr>
  
</table>


</form:form>
